document.write('<script src="static/js/ajaxfileupload.js"' + '></' + 'script>')

function image_upload(img, img_src, img_val){
    $.ajaxFileUpload({
        type: "post",
        fileElementId:img,
        data: {},
        url: "?ct=upload&ac=upload_img&img_id="+img,
        dataType: 'json',
        success: function (data) {
            if(data.error == 0){
                var src = $('#'+img_src);
                $("#"+img_val).val(data.filename);
                src.attr("src",data.url);
                src.css("display","inline-block");
            }else{
                alert(data.msg);
            }
        }
    });
}